package org.e_gold.service.impl;

import org.e_gold.dao.SettledContractDAO;
import org.e_gold.model.Contract;
import org.e_gold.model.Event;
import org.e_gold.model.SettledContract;
import org.e_gold.service.SettledContractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class SettledContractServiceImpl extends _NavigatorService implements SettledContractService {

    @Autowired
    private SettledContractDAO settledContractDAO;

    @Override
    @Transactional
    public Event getRunningEvent(SettledContract running) {

        Contract contractRunning = running.getContract();
        return contractRunning.getEvent();
    }

    @Override
    public void updateAllRunningToFalse() {

        settledContractDAO.updateAllRunningToFalse();
    }

    @Override
    public SettledContract getRunningSettledContract() {

        return settledContractDAO.getRunningSettledContract();
    }

}
